package com.mh.mh.util;

public class MyUtil {

    public static void main(String[] args) {
        String str = "初六";
        int length = str.length();

        if (length > 0) {
            char lastChar = str.charAt(length - 1);
            System.out.println("Last character: " + lastChar);
        } else {
            System.out.println("String is empty.");
        }
    }


    public static String getLastStr(String str){
        int length = str.length();

        char lastChar = str.charAt(length - 1);
//        if (length > 0) {
//            System.out.println("Last character: " + lastChar);
//        } else {
//            System.out.println("String is empty.");
//        }
        return String.valueOf(lastChar);
    }


}
